package com.df.chat.service;

import com.df.base.other.R;
import com.df.base.other.IGateWayRpcInterface;
import org.apache.dubbo.common.utils.PojoUtils;
import org.apache.dubbo.config.annotation.DubboService;

@DubboService(group = "${spring.application.name}",version = "${code.version}")
public class ChatServiceProvider implements IGateWayRpcInterface {
    @Override
    public R rpc(Object o) {
        Object generalize = PojoUtils.generalize(o);

        System.out.println("收到消息了:"+ o);
        //TODO 通过传过来的功能名，映射到具体的service的具体方法进行调用，但是这样会用到反射，性能大打折扣，思考一个尽量少用发射的方法
        R r = new R();
        r.setCode(200);
        r.setMsg("Chat");
        return r;
    }
}
